/*
-------------------------------------------------

	Console.h

	Dmitriy Kuzmenko (Dgut)

-------------------------------------------------
*/

#ifndef __AUTUMN_CONSOLE_H__
#define __AUTUMN_CONSOLE_H__

#include "Singleton.h"
#include <stdio.h>
#include <map>
#include <string>
#include <vector>

namespace Autumn
{

#define gConsole Console::GetInstance()

class Console : public Singleton< Console >
{
	typedef void				( * Command )( int, const char * * );

	FILE *						stream;

	std::vector< std::string >	logs;
	std::map< std::string, std::string >
								variables;
	std::map< std::string, Command >
								commands;

								Console( void );
								~Console( void );
public:
	const bool					Init( void );
	void						Shutdown( void );

	void						Log( const char * text/*, ...*/ );
	const char * const			GetLog( int line ) const;

	void						SetVariable( const char * name, const char * value );
	const char * const			GetVariable( const char * name ) const;
	const float					GetVariableFloat( const char * name ) const;

	void						AddCommand( const char * name, Command command );

	void						Execute( const char * text );

	friend class				Singleton< Console >;
};

}	// namespace Autumn

#endif	// !!! __AUTUMN_CONSOLE_H__ !!!